1. Field of the Invention
This invention relates to a method and apparatus for compressing and expanding digital image data, especially, relates to image compression by reducing the number of pixels of original image data, and image expansion by increasing the number of pixels of reduced-image data.
2. Description of the Related Art
In an example of an image compression method, it has been known to calculate the average value of a predetermined number of pixels. In this compression method, applied to original digital image data, which is partitioned into pixel-blocks composed of a plurality of pixels, an average pixel value for the plurality of pixels is calculated in each block. Consequently, reduced-image data composed of pixels having the average pixel values is obtained. When expanding the reduced-image data to restore the original image, an interpolation processing, such as a linear interpolation, is usually performed so that expanded-image data corresponding to the original image data is obtained.
However, since part of the information included in the original image data is lost in the process of generating the reduced-image data, pixel values generated by the interpolation processing are not necessarily equal to corresponding pixel values in the original image data. Namely, the expanded-image data does not coincide with the original image-data. Therefore, picture quality decreases in the process of the compression and expansion processing, and the original image data can not be completely restored.
Therefore, an object of the present invention is to provide a method and apparatus for compressing and expanding digital image data efficiently, while limiting degradation in picture quality.
A compression apparatus for compressing image data according to the present invention has a reduced-image generating processor, a fluency transform processor, a mode setting processor, an error calculating processor and an optimum mode determining processor. The reduced-image generating processor transforms original image data partitioned into first blocks, each of which is composed of a plurality of pixels, to reduced-image data composed of a smaller number of pixels than that of the original image data. The fluency transform processor applies a fluency transform to the reduced-image data to generate expanded-image data partitioned into second blocks corresponding to the first blocks. The fluency transform has a plurality of modes. The mode setting processor selects one mode from the plurality of modes, thus the expanded-image data is generated in accordance with the selected one mode. The error calculating processor calculates an error, which represents a difference between the original image data and the expanded-image data, the error calculating processor calculating the error in each of the plurality of modes. Then, the optimum mode determining processor determines an optimum mode, by which the error becomes a minimum, among the plurality of modes. Preferably, the compression apparatus has a recording medium for recording the optimum mode and the reduced-image data.
On the other hand, an expansion apparatus for expanding the reduced-image data according to the present invention has a data reading processor, an optimum mode setting processor and an expanded-image generating processor. The data reading processor reads the reduced-image data and the optimum mode recorded in the recording medium. The optimum mode setting processor sets the optimum mode among the plurality of modes. Then, the expanded-image generating processor applies the fluency transform according to the optimum mode to the reduced-image data, thus expanded-image data corresponding to the original image data is obtained. As the optimum mode is determined in the compression apparatus in advance, the expanded-image data closer to the original image data can be obtained.
According to another aspect of the present invention, a compression apparatus for compressing image data has a reduced-image generating processor, a fluency transform processor, a contrast coefficient calculating processor, a contrast transform processor, a mode setting processor, an error calculating processor and an optimum mode/contrast determining processor. The reduced-image generating processor transforms original image data partitioned into first blocks, each of which is composed of a plurality of pixels, to reduced-image data composed of a smaller number of pixels than that of the original image data. The fluency transform processor applies a fluency transform to the reduced-image data to generate expanded-image data partitioned into second blocks corresponding to the first blocks. The fluency transform has a plurality of modes. The contrast coefficient calculating processor obtains a contrast coefficient in such a manner that a contrast of the expanded-image data becomes close to a contrast of the original image data by applying the contrast coefficient to the expanded-image data. The contrast transform processor applies the contrast coefficient to the expanded-image data to modify the contrast of the expanded-image data. Consequently, modified expanded-image data is obtained. The mode setting processor selects one mode from the plurality of modes, thus, the modified expanded-image data is generated in accordance with the selected one mode. The error calculating processor calculates an error, which represents a difference between the original image data and the modified expanded-image data, the error calculating processor calculating the error in each of the plurality of modes. The optimum mode/contrast determining processor determines an optimum mode, by which the error becomes a minimum, among the plurality of modes, and then sets a contrast coefficient corresponding to the optimum mode as an optimum contrast coefficient. Preferably, the compression apparatus has a recording medium for recording the optimum mode, the optimum contrast coefficient and the reduced-image data.
On the other hand, an expansion apparatus corresponding to the compression apparatus has a data reading processor, an optimum mode setting processor, an expanded-image generating processor and a contrast modifying processor. The data reading processor reads the reduced-image data, the optimum contrast coefficient and the optimum mode recorded in the recording medium. The optimum mode setting processor sets the optimum mode among the plurality of modes. The expanded-image generating processor applies the fluency transform according to the optimum mode to the reduced-image data such that expanded-image data corresponding to the original image data is obtained. The contrast modifying processor applies the contrast transform based on the optimum contrast coefficient to the expanded-image data, to obtain modified expanded-image data.